<?php
/**
 *
 * @author Haohao
 * @date 2022-04-18 4:08 下午
 *
 */

namespace app\common\model\tang;


use app\common\impl\Comm;
use app\common\model\CommonBaseModel;
use Jrk\Tree;
class OrganizationConfig extends CommonBaseModel implements Comm
{

    public function getAdminPageData($param = [], $order = 'id asc',$where=[])
    {

        if(isset($param['name'])){
            $where[] = ['name','like',"%{$param['name']}%"];
        }
        // TODO: Implement getAdminPageData() method.
        $model = $data = self::where($where) ;
        $data = $model->order($order)->select()->toArray();
        $count =$model->count("id");
        $data = Tree::DeepTree($data,"treeList");
        return parent::ajaxResult($data, $count);
    }
    public function subject(){
        return $this->hasOne(SubjectList::class,'id','subject_id');
    }
    public function delById($id)
    {
        // TODO: Implement delById() method.
        return parent::del($id);
    }

    public function doAll($data)
    {
        // TODO: Implement doAll() method.
        return parent::doAllData($data);
    }
}